﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResourceAssign.aspx.cs"
    Inherits="ZX.WebApp.Crm.MeetingArrange.ResourceAssign" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>资源分配</title>
    <style type="text/css">
        .readOnly
        {
            background-color: lightgrey;
        }
    </style>
      <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
    <script src="../../Scripts/extend.validate.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
</head>
<body class="yui-skin-sam">
    <div>
        <div id="toolbar">
            <button type="button" id="btnSave" name="btnSave">
                保存</button>
            <button type="button" id="btnClose" name="btnClose">
                返回</button>
        </div>
        <div>
            <table id="TeacherSum" cellpadding="0" cellspacing="0" style="line-height: 35px">
                <tr>
                    <td>
                       &nbsp 客户编码:
                    </td>
                    <td>
                        <input type="text" name="Code" />
                    </td>
                    <td>
                        &nbsp 客户名称:
                    </td>
                    <td>
                        <input type="text" name="CustomerName" class="readOnly" readonly="readonly" />
                    </td>
                    <td>
                        &nbsp 客户来源:
                    </td>
                    <td>
                        <input type="text" name="originName" class="readOnly" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp 产品:
                    </td>
                    <td>
                        <input type="text" name="CompanyProduct" class="readOnly" />
                    </td>
                    <td>
                        &nbsp 所属行业:
                    </td>
                    <td>
                        <input type="text" name="TradeName" class="readOnly" readonly="readonly" />
                    </td>
                    <td>
                        &nbsp 所属分公司:
                    </td>
                    <td>
                        <input type="text" name="OrderofDeptName" class="readOnly" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp 信息专员:
                    </td>
                    <td>
                        <input type="text" name="AddUserName" class="readOnly" readonly="readonly" />
                    </td>
                    <td>
                        &nbsp 行销顾问:
                    </td>
                    <td>
                        <input type="text" name="SaleadviserName" class="readOnly" readonly="readonly" />
                    </td>
                    <td>
                        &nbsp 一推讲师:
                    </td>
                    <td>
                        <input type="text" name="LectorName" class="readOnly" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <td>
                       &nbsp  客户经理:
                    </td>
                    <td>
                        <input type="text" name="CustomerMgrName" class="readOnly" readonly="readonly" />
                    </td>
                    <td>
                       &nbsp  课中服务人:
                    </td>
                    <td>
                        <input type="text" name="ClassServerName" readonly="readonly" class="readOnly" />
                    </td>
                    <td colspan='2'>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp 负责交付人:
                    </td>
                    <td>
                        <input type="text" name="ClassFrontServerName" class="readOnly" readonly="readonly" />
                    </td>
                    <td>
                        &nbsp 高级管理顾问:
                    </td>
                    <td>
                        <input type="hidden" id="NegotiateTeach" name='NegotiateTeach' />
                        <input id="txtNegotiateTeach" name="NegotiateTeachName" type="text" readonly="readonly"
                            value="" dtype="Z" style="width: 160px" />
                        <button id="btnNegotiateTeach" name="V" type="button" value="" style="line-height: 1">
                                选择</button>

                    </td>
                    <td colspan='2'>
                    </td>
                </tr>
            </table>
        </div>

        <div id="dialog1" class="yui-pe-content">
            <div class="hd">
                选择用户</div>
            <div class="bd">
                <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                    margin: 0px; padding: 0px;"></iframe>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">
     <asp:Literal ID="EditTemplate" runat="server"></asp:Literal>

     //布局初始化
    (function () {
        var Dom = YAHOO.util.Dom,
            Event = YAHOO.util.Event;
        Event.onDOMReady(function () {
            var layout = new YAHOO.widget.Layout({
                units: [
                { position: 'top', height: 35, body: 'toolbar', gutter: '1 1 1 1', scroll: null, zIndex: 2 },
                { position: 'center', body: 'TeacherSum', gutter: '0 1 1 1', scroll: true }
                ]
            });
            layout.render();
            initWindow();
        });
       })();


       //注册按钮事件
       YAHOO.namespace("example.container");
      YAHOO.example.init = function () {
        function onButtonClick(p_oEvent) {
            switch (this.get("id")) {
                case "btnSave":
                    Save();
                    break;
                case "btnClose":
                    Close();
                    break;
                default:
                    break;
            }
        }
        YAHOO.util.Event.onContentReady("toolbar", function () {
           var btnSave = new YAHOO.widget.Button("btnSave");
            btnSave.on("click", onButtonClick);
           var btnClose = new YAHOO.widget.Button("btnClose");
            btnClose.on("click", onButtonClick);
    });
    } ();

     YAHOO.namespace("example.container");
    YAHOO.util.Event.onDOMReady(function () {
        var handleSubmit = function () {   
            var editwindow = document.getElementById("EditUIWindow1");
            if (editwindow) {
                editwindow.contentWindow.ChooseInfo(); 
            }
            YAHOO.example.container.dialog1.hide();
        };

        var handleCancel = function () {
            this.cancel();
        };
        var handleSuccess = function (o) {
            var response = o.responseText;
            response = response.split("<!")[0];
            document.getElementById("resp").innerHTML = response;
        };
        var handleFailure = function (o) {
            alert("Submission failed: " + o.status);
        };
        YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
					            { width: "650px",
					                height: "480px",
					                fixedcenter: true,
					                visible: false,
					                draggable: true,
					                close: true,
					                autofillheight: "body",
					                constraintoviewport: true,
					                buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								            { text: "取消", handler: handleCancel}]
					            });
        YAHOO.example.container.dialog1.callback = { success: handleSuccess, failure: handleFailure };
        YAHOO.example.container.dialog1.render();
        //拖动大小
        var resize = new YAHOO.util.Resize("dialog1", {
            handles: ["br"],
            autoRatio: false,
            minWidth: 650,
            minHeight: 450,
            status: false
        });
        resize.on("startResize", function (args) {
            if (this.cfg.getProperty("constraintoviewport")) {
                var D = YAHOO.util.Dom;
                var clientRegion = D.getClientRegion();
                var elRegion = D.getRegion(this.element);
                resize.set("maxWidth", clientRegion.right - elRegion.left - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
                resize.set("maxHeight", clientRegion.bottom - elRegion.top - YAHOO.widget.Overlay.VIEWPORT_OFFSET);
            } else {
                resize.set("maxWidth", null);
                resize.set("maxHeight", null);
            }
        }, YAHOO.example.container.dialog1, true);
        resize.on("resize", function (args) {
            var panelHeight = args.height;
            this.cfg.setProperty("height", panelHeight + "px");
        }, YAHOO.example.container.dialog1, true);
    });
    //初始化表格内容

    $("#TeacherSum").JSONToForm($.toJSON(instance[0]));

    //将对象赋值
    var setValue=function(){
       instance[0].NegotiateTeach=$("#NegotiateTeach").val();
    }
    //保存
    var Save=function(){
       setValue();
       var url = "../../Extend/AjaxData/DataSave.aspx";
       var json =$.toJSON(instance[0]).replace(/'/g,"[B]");
            $("#TeacherSum").SaveData(url,"CrmDeliverMajor",json,"update");  
         alert('操作成功');
        Close();
    }
    //关闭当前页
    var Close = function () {
        RefreshData();
        window.parent.$("#tabs").tabs('close', '资源分配');
    }
      function RefreshData() {
            if (parent.NeedRefreshPage != null) {
                if (typeof (parent.NeedRefreshPage.BindData) == "function") {
                    parent.NeedRefreshPage.RefreshData();
                }
            }
        }
       /* 对应的方法和ID*/
        var _fn, _id;
        function ShowDialog(fn, id,src) {
            _fn = fn;
            _id = id;
            document.getElementById("EditUIWindow1").src = src;
            YAHOO.example.container.dialog1.show();
        }
</script>
</html>
